package com.joinway.framework.bean.exception;

import com.joinway.framework.bean.constant.ErrorCodeConstants;



public class InternalException extends RuntimeException {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3303875285927289314L;

	protected String code;

	/**
	 * display information rather than error message
	 */
	protected String description;
	
	public InternalException() {
		super();
		this.code = ErrorCodeConstants.INTERNAL_ERROR;
	}

	public InternalException(String code, String description) {
		this(code, description, description);
	}
	
	public InternalException(String code, String description, String message) {
		super(message);
		this.code = code;
		this.description = description;
	}
	
	public InternalException(String message, Throwable cause) {
		super(message, cause);
		this.code = ErrorCodeConstants.INTERNAL_ERROR;
		this.description = message;
	}

	public InternalException(String message) {
		super(message);
		this.code = ErrorCodeConstants.INTERNAL_ERROR;
		this.description = message;
	}

	public InternalException(Throwable cause) {
		super(cause);
		this.code = ErrorCodeConstants.INTERNAL_ERROR;
		this.description = ErrorCodeConstants.INTERNAL_ERROR_DESC;
	}

	public String getCode() {
		return code;
	}

	public String getDescription() {
		return description;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Override
	public String toString() {
		return super.toString() + "{code=" + code + ", description=" + description + "}";
	}
	
}
